package org.advanced.publish;

import redis.clients.jedis.Jedis;

/**
 * @author John.zhang
 * @version Id: Publish, v 1.0 2020/12/22 17:43 ZhiYong Exp $
 * redis的发布订阅
 * <p>
 * 命令
 * 订阅：subscribe channel-1 channel-2 channel-3 /unsubscribe channel-1/发布：publish channel-1 value
 * psubscribe *sport、psubscribe news*、psubscribe new-weather /publish new-sport value
 *
 */
public class Publish {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("10.181.144.255", 6379);
        jedis.publish("channel-1", "A");
        jedis.publish("channel-2", "B");
    }
}
